package com.gxa.xly2024.controller;

import com.gxa.xly2024.pojo.Drug;
import com.gxa.xly2024.pojo.Purchase;
import com.gxa.xly2024.service.impl.DrugServiceImpl;
import com.gxa.xly2024.service.impl.PurchaseServiceImpl;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/drug")
public class DrugController {

    @Resource
    private DrugServiceImpl drugService;

    @GetMapping("/selectDrug")
    public Map<String, Object> selectDrug() {
        return this.drugService.selectDrug();
    }

    @PostMapping("/insert_Drug")
    public Map<String, Object> insert(@RequestBody Drug drug) {   // 接收前端传递的json对象
        return this.drugService.insert(drug);
    }

    @PostMapping("/updateById_Drug")
    public Map<String, Object> updateById(@RequestBody Drug drug) {   // 接收前端传递的json对象
        return this.drugService.updateById(drug);
    }
    @PostMapping("/deleteById_Drug")
    public Map<String, Object> deleteById(Integer id) {   // 接收前端传递的json对象
        return this.drugService.deleteById(id);
    }
}
